using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BodyControl : MonoBehaviour
{
    public int lastness;

    private void OnEnable()
    {
        GameManager.Instance.OnPlayerDeath += Rot;
        lastness = 10;
    }

    private void OnDisable()
    {
        GameManager.Instance.OnPlayerDeath -= Rot;
    }

    private void Rot(Vector3 tar)
    {
        this.lastness += -1;
        if (lastness == 0)
            Destroy(gameObject);
    }


}
